package com.example.helloandroid;

import com.example.helloandroid.R;
import com.example.helloandroid.R.id;
import com.example.helloandroid.R.layout;
import com.example.helloandroid.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.view.View.OnKeyListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

public class Android extends Activity {
	private EditText et;
	private EditText p;
	private String sex;
	protected void setSex(String sex) {
		// TODO Auto-generated method stub
		this.sex=sex;
	}
	
	/*protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_android); 
		et=(EditText)findViewById(R.id.editText1);
		p=(EditText)findViewById(R.id.editText2);
		final RadioButton rd=(RadioButton)findViewById(R.id.Sex_Man);
		RadioButton rd1=(RadioButton)findViewById(R.id.Sex_Woman);
		Button btn1=(Button)findViewById(R.id.button1);
		ImageButton btn2=(ImageButton)findViewById(R.id.imageButton1);
		RadioGroup rg=(RadioGroup)findViewById(R.id.Sex_RadioGroup);
		rg.setOnCheckedChangeListener(new OnCheckedChangeListener(){
			public void onCheckedChanged(RadioGroup arg0, int arg1) {
				// TODO Auto-generated method stub
				String sex="";
				if(rd.isChecked()){
					sex="This man name is";
				}else{
					sex="This. woman name is";
				}
				setSex(sex);
			}
		});
		
		btn1.setOnClickListener(new OnClickListener(){
			public void onClick(View v){
				TextView tv1=(TextView)findViewById(R.id.textView3);
				tv1.setText("you press normal button"+et.getText());
			}
		});
		et.setOnKeyListener(new OnKeyListener(){
			public boolean onKey(View arg0, int keyCode, KeyEvent event) {
				TextView tv3=(TextView)findViewById(R.id.textView3);
				if(keyCode==66){
					tv3.setText("you press normal button"+et.getText());
				}
				return true;
			}
		});
		btn2.setOnClickListener(new OnClickListener(){
			public void onClick(View v){
				TextView tv2=(TextView)findViewById(R.id.textView3);
				tv2.setText("you press imagebutton"+p.getText());
			}

		});     
	}
	
	
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.android, menu);
		return true;
	}*/

}
